<?php
/**
 * Created by JetBrains PhpStorm.
 * User: ECHEBAO
 * Date: 06/05/12
 * Time: 12:55
 * To change this template use File | Settings | File Templates.
 * RegisterForm class.
 * RegisterForm is the data structure for keeping
 * user registration form data. It is used by the 'register' action of 'SiteController'.
 * http://www.yiiframework.com/wiki/19/how-to-use-a-single-form-to-collect-data-for-two-or-more-models
 * since we collect data from multi table or models, this one is no longer used.
 */

class RegistrationForm extends CFormModel
{
    public $username;
    public $password;
    public $email;
    public $business_id;

    private $_identity;

    /**
     * Declares the validation rules.
     * The rules state that username, password & email are required,
     * and username & email needs to be unique.
     */
    public function rules()
    {
        return array(
            // username, email and password are required
            array('username, password, email, business_name','required'),
            // make sure username and email are unique
            array('username', 'unique', 'className'=> 'Account'),
            array('email', 'unique', 'className'=> 'Account'),
        );
    }

    /**
     * Declares attribute labels.
     */
    public function attributeLabels()
    {
        return array(
            'username'=>'Your username',
            'password'=>'Your password',
            'email'=>'Needed to activate your account',
            'business_name'=>'name of your business'
        );
    }
}